<?php
require_once(substr(__FILE__, 0, strrpos(__FILE__, '/')) . "/JSON.php");

class Object
{
}

class Error
{
  function Error($message)
  {
    if ($message === "")
    {
      $message = false;
    }
    $this->db = new Object();
    $this->db->error = new Object();
    $this->db->error->message = $message;
    $this->send();
  }
  
  function send()
  {
    fwrite(STDERR, utf8_encode(json_encode($this->db) . "\n"));
  }
}

class Output
{
  function Output($message)
  {
    $this->db = new Object();
    $this->db->output = new Object();
    $this->db->output->message = $message;
    $this->send();
  }
  
  function send()
  {
    fwrite(STDOUT, utf8_encode(json_encode($this->db) . "\n"));
  }
}
?>